﻿@using Web.ViewModel.CoreData

@{
    ViewBag.Title = "欢迎进入后台管理";
    Layout = "~/Views/Shared/_BackStageLayout.cshtml";
    List<SysUserModel> list = (List<SysUserModel>)ViewData["Data"];
}
<div id="content" class="content">
    <!-- begin breadcrumb -->
    <ol class="breadcrumb pull-right">
        <li><a href="javascript:;">用户列表</a></li>
    </ol>
    <!-- end breadcrumb -->
    <!-- begin page-header -->
    <!-- end page-header -->
    <!-- begin row -->
    <div class="row">
        <!-- begin col-12 -->
        <div class="col-md-12">
            <!-- begin panel -->
            <div class="panel panel-inverse">
                <div class="panel-body">
                    <div class="table-responsive">
                        <table id="data-table" class="table table-striped table-bordered">
                            <thead>
                                <tr>
                                    <th>帐号</th>
                                    <th>姓名</th>
                                    <th>手机号</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                @foreach (var data in list)
                                {
                                    <tr class="odd ">
                                        <td>@data.Account</td>
                                        <td>@data.Name</td>
                                        <td>@data.Phone</td>
                                        <td><button type="button" class="btn btn-primary btn-xs m-r-5 m-b-5 reset" sysId="@data.Id">重置密码</button></td>
                                    </tr>
                                }
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <!-- end panel -->
        </div>
        <!-- end col-12 -->
    </div>
    <!-- end row -->
</div>

@section footer {
    <script>
        $(document).ready(function () {
            App.init();
            TableManageDefault.init();

            $(".reset").click(function () {
                var id = $(this).attr("sysId");
                client.api.resetPassword({ "id": id }, function (data) {
                    if (data.ReCode == "1000") {
                        alert("重置成功");
                    } else {
                        alert("请尝试重新再试");
                    }
                }, function (data) {
                });
            });


        });
    </script>
}
